package cn.wit.summit.chwan.widgets;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import cn.wit.summit.chwan.R;
import cn.wit.summit.chwan.utils.StringUtils;

/**
 * Created by tangbl on 2018/4/20.
 */

public class AddNickDialog extends Dialog {

    private TextView currencyPromptTitleTx;
    private ImageView cancelIv;
    private EditText currencyPromptNickEt;
    private Button currencyPromptBt;

    public AddNickDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setCancelable(false);  //是否获取界外焦点
        Window dialogWindow = getWindow();
        dialogWindow.setBackgroundDrawableResource(android.R.color.transparent);
        dialogWindow.setGravity(Gravity.CENTER);
        setContentView(R.layout.dialog_add_nick_view);
        currencyPromptTitleTx = findViewById(R.id.currencyPromptTitleTx);
        currencyPromptNickEt = findViewById(R.id.currencyPromptNickEt);
        currencyPromptBt = findViewById(R.id.currencyPromptBt);
        cancelIv = findViewById(R.id.cancelIv);

    }

    public void setOkBtn(View.OnClickListener clickListener) {
        currencyPromptBt.setOnClickListener(clickListener);
    }

    public void setCancleBtn(View.OnClickListener clickListener) {
        cancelIv.setOnClickListener(clickListener);
    }

    public void setMsg(String txt) {
        currencyPromptNickEt.setHint(txt);
    }

    public EditText getCurrencyPromptNickEt() {
        return currencyPromptNickEt;
    }

    public String getNick() {
        return currencyPromptNickEt.getText().toString().trim();
    }

    public void setTitle(String txt) {
        currencyPromptTitleTx.setText(txt);
    }

}
